const app = getApp();
var url = app.data.url;
var picRoot = app.data.picRoot;
Page({

  /**
   * 页面的初始数据
   */
  data: {
    desk: [],
    value: "",
    orderId: "",
    roomPic: [],
    roomName: '',
    roomDesc: '',
    roomNum: '',
    payType: 0,
  },
  onLoad: function(options){
    let orderId = options.orderId;
    let _that = this;
    _that.setData({
      orderId: orderId
    })
    _that.selectDetail(orderId);
  },
  selectDetail: function (orderId) {
    let _that = this;
    let uuid = app.globalData.openId;
    wx.request({
      url: url + '/OrderApi/queryHotelDetailByOrderId',
      data: {
        uuid: uuid,
        orderId: orderId
      },
      method: 'POST',
      header: {
        'content-type': 'application/x-www-form-urlencoded'
      },
      success: function (res) {
        if (res.data.code == 200) {
          console.log(res.data.data);
          let item = res.data.data
          let img = item.img;
          let imgArr = img.split(",");
          let tempList = [];
          for (var i = 0; i < imgArr.length; i++) {
            if (imgArr[i]) {
              tempList.push(picRoot + imgArr[i]);
            }
          }

          _that.setData({
            payType: item.payType,
            roomPic: tempList,
            roomName: item.roomName,
            roomDesc: item.roomDesc,
            roomNum: item.roomNum,
            list8: item.list8,
            list9: item.list9,
            list10: item.list10,
            list11: item.list11,
            list12: item.list12,
          })
        } else {
          wx.showToast({
            title: res.data.msg,
            icon: "none",
            duration: 2000
          })
        }
      },
      fail: function (res) {
        console.info('submit fail');
      },
      complete: function (res) {
        console.info('submit complete');
      }
    })
  },
  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
  }
  
})